package server.business.pojo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.io.Serializable;
import java.util.Date;

import org.springframework.format.annotation.DateTimeFormat;

import lombok.Data;
import server.business.converter.Converter.*;

/**
 * 
 * @TableName autologous_blood_information
 * @author Galaxy
 */
@TableName(value = "autologous_blood_information")
@Data
public class AutologousBloodInformation implements Serializable {
    /**
     * 编号
     */
    @ExcelIgnore
    @TableId(value = "id")
    private Integer id;

    /**
     * 创建时间
     */
    @ExcelIgnore
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(value = "gmt_create", fill = FieldFill.INSERT) // 创建注解
    private Date gmtCreate;

    /**
     * 修改时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(value = "gmt_modified", fill = FieldFill.INSERT_UPDATE) // 更新注解
    private Date gmtModified;

    /**
     * 患者身份证号码
     */
    @ExcelProperty("患者身份证号")
    @ColumnWidth(20)
    @TableField(value = "patient_idcard")
    private String patientIdcard;

    /**
     * 血装编号条码
     */
    @ExcelProperty("血装编号条码")
    @ColumnWidth(10)
    @TableField(value = "barcode")
    private Long barcode;

    /**
     * ABO血型
     */
    @ExcelProperty(value = "ABO血型", converter = AboTypeConverter.class)
    @ColumnWidth(10)
    @TableField(value = "abo_blood_type")
    private String aboBloodType;

    /**
     * rh血型
     */
    @ExcelProperty(value = "RH血型", converter = RhTypeCoverter.class)
    @ColumnWidth(10)
    @TableField(value = "rh_blood_type")
    private String rhBloodType;

    /**
     * 血液成分
     */
    @ExcelProperty(value = "血液成分", converter = BloodCompositionConverter.class)
    @ColumnWidth(10)
    @TableField(value = "blood_component")
    private String bloodComponent;

    /**
     * 扩展码
     */
    @ExcelProperty("扩展码")
    @ColumnWidth(10)
    @TableField(value = "extend_code")
    private String extendCode;

    /**
     * 规格
     */
    @ExcelProperty(value = "规格", converter = BloodSizeConverter.class)
    @TableField(value = "blood_count")
    private Integer bloodCount;

    /**
     * 血液失效时间
     */
    @ExcelProperty("血液失效时间")
    @ColumnWidth(20)
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(value = "failure_time")
    private Date failureTime;

    /**
     * 血液采集时间
     */
    @ExcelProperty("血液采集时间")
    @ColumnWidth(20)
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @TableField(value = "collect_time")
    private Date collectTime;

    /**
     * 入库、在库、已出库、已分配、废弃申请、患者退血中、血库退血中、取消入库、血站退血中、配血、待抽取血、已抽取血、血液加工
     */
    @ExcelProperty(value = "状态", converter = StateConverter.class)
    @ColumnWidth(10)
    @TableField(value = "state")
    private String state;

    /**
     * 血液ID
     */
    @ExcelProperty("血液ID")
    @ColumnWidth(10)
    @TableField(value = "blood_id")
    private String bloodId;

    /**
     * 血液位置
     */
    @ExcelProperty(value = "血液位置", converter = BloodLocationConverter.class)
    @ColumnWidth(10)
    @TableField(value = "blood_location")
    private String bloodLocation;

    /**
     * 规格
     */
    @ExcelProperty("规格")
    @ColumnWidth(10)
    @TableField(value = "measurement_unit")
    private Integer measurementUnit;

    /**
     * 批次号
     */
    @ExcelProperty("批次号")
    @ColumnWidth(10)
    @TableField(value = "batch_number")
    private Long batchNumber;

    @TableField(exist = false)
    private static final long serialVersionUID = -8864782959504290900L;
}